package com.sunqizhong.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sunqizhong.entity.Clazz;
import com.sunqizhong.entity.Emp;
import com.sunqizhong.entity.PageBean;
import com.sunqizhong.entity.Student;
import com.sunqizhong.mapper.ClazzsMapper;
import com.sunqizhong.mapper.StudentMapper;
import com.sunqizhong.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpi implements StudentService {
    @Autowired
    private StudentMapper studentMapper;
    private ClazzsMapper clazzsMapper;

    /*
    * 学员列表分页查询
    * */
    @Override
    public PageBean page(Student param) {
        PageHelper.startPage(param.getPage(),param.getPageSize());
        List<Student> studentList = studentMapper.list(param);
        Page<Student> p = (Page<Student>) studentList;
        return new PageBean(p.getTotal(),p.getResult());
    }


    /*
    * 添加学员
    * */
    @Override
    public void save(Student student) {
        studentMapper.insert(student);
    }

    /*
    * 批量删除学员
    * */
    @Override
    public void deleteByIds(Integer[] ids) {
        studentMapper.deleteByIds(ids);
    }
}
